public class LeetCode334 {
    public static void main(String[] args) {
        int[] nums = {20,100,10,12,5,13};
        LeetCode334 leetCode334 = new LeetCode334();
        System.out.println(leetCode334.increasingTriplet(nums));
    }

    /**
     * 贪心算法
     * @param nums
     * @return
     */
    public boolean increasingTriplet(int[] nums) {
        boolean result = false;
        if (nums.length < 3){
            return result;
        }
        int num1 = nums[0];
        int num2 = Integer.MAX_VALUE;
        for (int i = 1; i < nums.length; i++){
            int indexNum = nums[i];

            System.out.println(num1 + "  "  + num2 + "  " + indexNum);
            if (indexNum > num2){
                return true;
            }
            if (indexNum > num1){
                num2 = indexNum;
                continue;
            }

            num1 = indexNum;
        }

        return result;
    }
}
